package com.tadpole.music.adapter.me;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.home.ClockInBean;
import com.tadpole.music.holder.base.BaseViewHolder;
import com.tadpole.music.holder.home.DayViewHolder;
import com.tadpole.music.holder.me.V2DayViewHolder;

import java.util.List;

/**
 * Created By 孙岩
 * on 2020/12/26
 */
public class V2DayAdapter extends BaseAdapter {
    private OnItemClickListener onItemClickListener;
    private Activity activity;
    private V2DayViewHolder v2DayViewHolder;
    private List<ClockInBean> list;
    //判断是不是当天
    private int p;
    public V2DayAdapter(Activity activity,List<ClockInBean> list,int p){
        this.activity = activity;
        this.list = list;
        this.p = p;
    }


    @Override
    public BaseViewHolder createRelHolder(ViewGroup parent, int viewType) {
        v2DayViewHolder = new V2DayViewHolder(activity, LayoutInflater.from(activity).inflate(R.layout.item_date_v2, parent, false),list,p,onItemClickListener);
        return  v2DayViewHolder;
    }

    @Override
    public int getRelItemCount() {
        return list.size();
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener listener) {
        this.onItemClickListener = listener;
    }

    @Override
    public void setOnChildClickListener(OnChildClickListener listener) {

    }

    @Override
    public void setOnLongClickListener(OnLongClickListener listener) {

    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        holder.init(position - mHeadViews.size());
    }
}
